const app = getApp()  //获取应用实例
const userDB = wx.cloud.database().collection("user")
const recordsDB = wx.cloud.database().collection("records")

Page({
  data: {                                                                                                                                  
  },

  tokepu(){
    wx.navigateTo({
      url: '/pages/kepudetail/kepudetail',
    }) 
  },
  toyizhu(){
    wx.navigateTo({
      url: '/pages/yizhu/yizhu',
    })
  },
  top1(){
    wx.navigateTo({
      url: '/pages/kepupassage1/kepupassage1',
    })
  },
  top2(){
    wx.navigateTo({
      url: '/pages/kepupassage2/kepupassage2',
    })
  },
  top3(){
    wx.navigateTo({
      url: '/pages/kepupassage3/kepupassage3',
    })
  },
  top4(){
    wx.navigateTo({
      url: '/pages/kepupassage4/kepupassage4',
    })
  },

  //跳转到附近医点
  tohouyi(){
    wx.navigateTo({
      url: '/pages/map/map',
    })
  },

  //跳转到你问我答界面
  handleContact (e) {
    console.log(e.detail.path)
    console.log(e.detail.query)
  },

  //跳转到病友结对的功能
  tohuifu(){
    userDB.where({
      _openid:app.globalData.openid
    }).get({
      success:res=>{
        if(res.data[0].friend=='暂无'){
          wx.navigateTo({
            url:'/pages/applyfriend_pre/applyfriend_pre',
          })
        }else{
          wx.navigateTo({
            url:'/pages/lookfriend/lookfriend',
          })
        }
      }
    }) 
  },

  //跳转到自测模块
  tojixing(){
    wx.navigateTo({
      url: '/pages/test_index/test_index',
    })
  },

  //跳转到助眠减压
  toshuijiao(){
    wx.navigateTo({
      url: '/pages/relax/relax',
    })
  }


})